package com.gargi.crimpatrol.utils;

import com.gargi.crimepatrol.main.CrimePatrolMidlet;
import com.sun.lwuit.Button;
import com.sun.lwuit.Dialog;
import com.sun.lwuit.Label;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;

public class DialogManager {
	
	private CrimePatrolMidlet m_crimepatrolmidlet;
	
	DialogManager(CrimePatrolMidlet midlet) {
		m_crimepatrolmidlet = midlet;
	}
	
	public void showAboutDialog() {
		final Dialog abtDialog = new Dialog("About");
		
		Label appNameLabel = new Label("Name: "+m_crimepatrolmidlet.getAppName());
		Label appVersionLabel = new Label("Version: "+m_crimepatrolmidlet.getAppVersion());
		Label appVendorLabel = new Label("Vendor: "+m_crimepatrolmidlet.getAppVendor());
		
		Button closeButton = new Button("ok");
		closeButton.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent arg0) {
					abtDialog.dispose();
			}
		});
		
		abtDialog.addComponent(appNameLabel);
		abtDialog.addComponent(appVersionLabel);
		abtDialog.addComponent(appVendorLabel);
		abtDialog.addComponent(closeButton);
		
		abtDialog.show();
	}

}
